<template>
  <div id="topSearch">
    <div class="search-box">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item>
          <el-select v-model="formInline.timeType" class="creationTiem">
            <el-option
              v-for="item in timeTypeList"
              :key="item.key"
              :label="item.key"
              :value="item.value"
            ></el-option>
          </el-select>
          <el-date-picker
            v-model="formInline.date"
            type="daterange"
            range-separator="至"
            start-placeholder="2019-01-03 24:00"
            end-placeholder="2019-03-07 12:00"
            class="datetimerange"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="通知状态">
          <el-select v-model="formInline.status" placeholder="请选择">
            <el-option
              v-for="item in taskStatusList"
              :key="item.key"
              :label="item.key"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="二审状态">
          <el-select v-model="formInline.secondStatus" placeholder="请选择">
            <el-option
              v-for="item in secondStatusList"
              :key="item.key"
              :label="item.key"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="触达通道">
          <el-select v-model="formInline.activeType" placeholder="请选择">
            <el-option
              v-for="item in taskTypeList"
              :key="item.key"
              :label="item.key"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="s-btn">
          <el-button
            type="success"
            icon="el-icon-search"
            @click="toSearch"
          >
            查询
          </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TopSearch',
  msg: '角色管理-顶部搜索',
  props: {
    formInline: {
      type: Object,
      default: function() {
        return {
          status: 0, // 通知状态,默认全部
          secondStatus: 0, // 二审状态,默认全部
          activeChannel: 0, // 触达通道,默认全部
          date: '', // 选择的时间
          timeType: 0 // 时间类型 默认创建时间
        }
      }
    }
  },
  data() {
    return {
      // 时间类型
      timeTypeList: [
        { key: '创建时间', value: 0 },
        { key: '发布时间', value: 1 }
      ],
      // 通知状态列表
      taskStatusList: [
        { key: '全部', value: 0 },
        { key: '已发布', value: 1 },
        { key: '进行中', value: 2 },
        { key: '未发布', value: -1 },
        { key: '已结束', value: -2 }
      ],
      // 二审状态列表
      secondStatusList: [
        { key: '全部', value: 0 },
        { key: '未审核', value: 1 },
        { key: '已通过', value: 2 },
        { key: '未通过', value: -1 }
      ],
      // 触达通道列表
      taskTypeList: [
        { key: '全部', value: 0 },
        { key: '推送', value: 1 },
        { key: '通知', value: 2 }
      ],
      inputValue: '' // 搜索框内容
    }
  },
  mounted() {},
  methods: {
    /* 搜索 */
    toSearch() {}
  }
}
</script>

<style lang="less">
#topSearch {
  .search-box {
    padding-left: 30px !important;
  }
  .creationTiem {
    .el-input__inner {
      border-radius: 3px 0 0 3px !important;
    }
  }
  .datetimerange {
    margin-left: -4px;
    border-radius: 0 3px 3px 0;
  }
}
.el-input .el-input--suffix {
  width: 90px !important;
}
</style>
